package com.ssps.front.rent.service.impl;

import com.ssps.entity.Orders;
import com.ssps.entity.OrdersExample;
import com.ssps.front.rent.service.LessorUserOrderService;
import com.ssps.mapper.OrdersMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @author lg
 * @time 2020/07/25 11:32:38
 */

@Service
public class LessorUserOrderServiceImpl  implements LessorUserOrderService {

    @Autowired
    OrdersMapper ordersMapper;

    @Override
    public List<Orders> orders(Integer uiid) {

        OrdersExample ordersExample=new OrdersExample ();
        OrdersExample.Criteria criteria = ordersExample.createCriteria ();
         criteria.andUiidEqualTo (uiid);
         List<Orders> orders = ordersMapper.selectByExample (ordersExample);
        return orders;
    }



    @Override
    public void addOrders(Orders orders) {

        ordersMapper.insert (orders);
    }

    @Override
    public Orders selectByonumberOrder(String onumber) {

          OrdersExample ordersExample=new OrdersExample ();
        OrdersExample.Criteria criteria = ordersExample.createCriteria ();
         criteria.andOnumberEqualTo (onumber);

        List<Orders> ordersList = ordersMapper.selectByExample (ordersExample);

           return  ordersList.get (0);
    }


}
